package utils.nfc
{
	import components.valueobjects.EventVO;

	public class NfcTagEvent extends NfcTagObject
	{

		public var uri:String;
		
		public function NfcTagEvent(tagID:int, event:EventVO, contentID:String = "1337", mode:String = "emulator")
		{
			super(tagID, RecordType.RECORD_TYPE_EVENT,contentID,mode);
			this.contentString = event.title;
			
			this.uri = getEventUriString(event);
		}
		
		
		private function getEventUriString(event:EventVO):String{
			var uri:String = 
				"BEGIN:VEVENT"	+
				"%0D%0ASUMMARY:"		+	event.title;
			if(event.date.allday){
				uri +=
				"%0D%0ADTSTART;VALUE=DATE:"	+	event.orgStartDate+
				"%0D%0ADTEND;VALUE=DATE:"		+	event.orgEndDate;
			}else{
				uri +=
				"%0D%0ADTSTART:"		+	event.orgStartDate+
				"%0D%0ADTEND:"		+	event.orgEndDate;
			}
			uri += 
				"%0D%0ALOCATION:"		+	event.location+
				"%0D%0ADESCRIPTION:"	+	event.address.street+" "+event.address.postal+" "+event.address.city+
				"%0D%0AEND:VEVENT"
			
			return "ch://masterarbeit/"+event.img;
		}
	}
}

